home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / gilhool2 / pulse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-10  |  1.4 KB  |  69 lines

  1. #define GLOBALS TRUE
  2. #include "pulse.h"
  3. #undef GLOBALS
  4.  
  5. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  6. {
  7.     MSG msg;
  8.  
  9.     if (!hPrevInstance)
  10.       if (!InitApplication(hInstance))
  11.         return (FALSE);
  12.  
  13.     if (!InitInstance(hInstance, nCmdShow))
  14.       return (FALSE);
  15.  
  16.     while (GetMessage(&msg, NULL, NULL, NULL))
  17.     {
  18.       TranslateMessage(&msg);
  19.       DispatchMessage(&msg);
  20.     }
  21.     return (msg.wParam);
  22. }
  23.  
  24.  
  25. BOOL InitApplication(HINSTANCE hInstance)
  26. {
  27.     WNDCLASS  wc;
  28.  
  29.     wc.style = NULL;
  30.     wc.lpfnWndProc = MainWndProc;
  31.     wc.cbClsExtra = 0;
  32.     wc.cbWndExtra = 0;
  33.     wc.hInstance = hInstance;
  34.     wc.hIcon = NULL;
  35.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  36.     wc.hbrBackground = GetStockObject(WHITE_BRUSH);
  37.     wc.lpszMenuName =  NULL;
  38.     wc.lpszClassName = "PulseWClass";
  39.  
  40.     return (RegisterClass(&wc));
  41.  
  42. }
  43.  
  44. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  45. {
  46.     HWND    hWnd;
  47.  
  48.     hWnd = CreateWindow("PulseWClass",
  49.                         "Pulse",
  50.                         WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
  51.                         CW_USEDEFAULT,
  52.                         CW_USEDEFAULT,
  53.                         100,
  54.                         50,
  55.                         NULL,
  56.                         NULL,
  57.                         hInstance,
  58.                         NULL);
  59.  
  60.     if (!hWnd)
  61.       return (FALSE);
  62.  
  63.     ShowWindow(hWnd, nCmdShow);
  64.     UpdateWindow(hWnd);
  65.     return (TRUE);
  66.  
  67. }
  68.  
  69.